package com.binguo.api.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.binguo.api.form.CustomerForm;
import com.binguo.api.form.MenJinForm;
import com.binguo.api.form.OrderForm;
import com.binguo.api.result.Result;
import com.binguo.api.result.ResultGenerator;
import com.binguo.api.service.ApiOrderService;
import com.binguo.common.enums.CodeType;
import com.binguo.model.api.dto.OrderDTO;
import com.binguo.thirdPay.AESUtil;
import com.binguo.thirdPay.Sha1;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

/**
 * @author yuritian
 * @Title: MenJinController
 * @ProjectName binguoDevelop
 * @Description: TODO
 * @date 2019-07-2716:08
 */
@Api(tags = "德沃门禁")
@RestController
@RequestMapping
public class MenJinController {

    @Autowired
    ApiOrderService apiOrderService;

    @PostMapping(value = "/api/dewo/menJinCreate", produces = APPLICATION_JSON_VALUE)
    @ApiOperation(value = "创建预订单", notes = "通过OrderForm")
    public Result menJinCreate(@RequestBody @Valid MenJinForm form,
                               HttpServletRequest request)throws Exception {
        apiOrderService.createMenjinOrder(form.getAuthCode(),form.getMachineCode());
        return ResultGenerator.genSuccessResult();
    }
}
